package validation;
import java.util.ArrayList;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;


public class TestDemo {
public static void main(String[] args) {
List<String> array = new ArrayList<String>();
array.add("war");
array.add("war assets administration");
array.add("war between the states");
array.add("war brides act");
array.add("war casualties");
array.add("");

WebDriver driver = new FirefoxDriver();
driver.get("http://gov.bowker.com/gis/login");
WebElement username = driver.findElement(By.id("username"));
username.sendKeys("gistestacct");
WebElement password= driver.findElement(By.id("password"));
password.sendKeys("welcome");
WebElement login = driver.findElement(By.id("submit"));
login.click();
WebElement inputbox = driver.findElement(By.id("searchText_0"));
inputbox.sendKeys("war");
try {
	Thread.sleep(500);
} catch (InterruptedException e) {
	e.printStackTrace();
}

//WebElement autocomplete = driver.findElement(By.className("t-autocomplete-menu"));
List<WebElement>autocomplete =driver.findElement(By.className("t-autocomplete-menu")).findElement(By.tagName("ul")).findElements(By.tagName("li"));
Tools.isDisplayed(autocomplete.get(0));
Tools.isDisplayed(autocomplete.get(1));
Tools.isDisplayed(autocomplete.get(2));
Tools.isDisplayed(autocomplete.get(3));
Tools.isDisplayed(autocomplete.get(4));
Tools.isDisplayed(autocomplete.get(5));
for (int i = 0; i < array.size(); i++) {
Tools.assertEquals(array.get(i),autocomplete.get(i).getText().trim());
}
autocomplete.get(1).click();
driver.quit();
	}
}



